package com.zpyr.common.database;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

import com.zpyr.common.LogManager;

public class DBLoader {
	private String jndi_name;
	protected LogManager logger = new LogManager();
	public DataSource dbLoading( DataSource ds ) {
		try {
			jndi_name = "jdbc/zpyr";
			Context initContext = new InitialContext();
			Context envContext  = (Context)initContext.lookup("java:/comp/env");
			ds = (DataSource)envContext.lookup( jndi_name );
			return ds;
		} catch (NamingException e) {
			logger.debug(e.toString() + ", tomcat server.xml 에서 "+jndi_name+" 을 확인하세요.");
			return null;
		}
	}
}
